/*
** XML document templates
*/

#include "defs.h"
#include "template.h"

#define MODEL_NAME	"mod_dlna_video"
#define MODEL_NUMBER	"ver 0.2"

const char* template_root =
    "<?xml version=\"1.0\"?>"
    "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">"
    "<specVersion>"
    "<major>1</major>"
    "<minor>0</minor>"
    "</specVersion>"
    "<device>"
    "<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>"
    "<friendlyName>%s</friendlyName>"
    "<manufacturer>bsdaemon</manufacturer>"
    "<manufacturerURL>http://d.hatena.ne.jp/bsdaemon/</manufacturerURL>"
    "<modelDescription>Apache DLNA MediaServer</modelDescription>"
    "<modelName>" MODEL_NAME "</modelName>"
    "<modelNumber>" MODEL_NUMBER "</modelNumber>"
    "<modelURL>https://code.google.com/p/mod-dlna-video/</modelURL>"
    "<serialNumber>%d</serialNumber>"
    "<UDN>uuid:%s</UDN>"
    "<dlna:X_DLNADOC xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\">DMS-1.50</dlna:X_DLNADOC>"
    "<presentationURL>" MODULE_ROOT "</presentationURL>"
    "<iconList>"
    "<icon>"
    "<mimetype>image/png</mimetype>"
    "<width>48</width>"
    "<height>48</height>"
    "<depth>24</depth>"
    "<url>" MODULE_ROOT "/sm.png</url>"
    "</icon>"
    "<icon>"
    "<mimetype>image/jpeg</mimetype>"
    "<width>48</width>"
    "<height>48</height>"
    "<depth>24</depth>"
    "<url>" MODULE_ROOT "/sm.jpg</url>"
    "</icon>"
    "<icon>"
    "<mimetype>image/png</mimetype>"
    "<width>120</width>"
    "<height>120</height>"
    "<depth>24</depth>"
    "<url>" MODULE_ROOT "/lrg.png</url>"
    "</icon>"
    "<icon>"
    "<mimetype>image/jpeg</mimetype>"
    "<width>120</width>"
    "<height>120</height>"
    "<depth>24</depth>"
    "<url>" MODULE_ROOT "/lrg.jpg</url>"
    "</icon>"
    "</iconList>"
    "<serviceList>"
    "<service>"
    "<serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>"
    "<serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>"
    "<controlURL>" MODULE_ROOT "/control/content</controlURL>"
    "<eventSubURL>" MODULE_ROOT "/event/content</eventSubURL>"
    "<SCPDURL>" MODULE_ROOT "/content.xml</SCPDURL>"
    "</service>"
    "<service>"
    "<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>"
    "<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>"
    "<controlURL>" MODULE_ROOT "/control/conn</controlURL>"
    "<eventSubURL>" MODULE_ROOT "/event/conn</eventSubURL>"
    "<SCPDURL>" MODULE_ROOT "/conn.xml</SCPDURL>"
    "</service>"
    "</serviceList>"
    "</device>"
    "</root>"
    ;

const char* template_content =
    "<?xml version=\"1.0\"?>"
    "<scpd xmlns=\"urn:schemas-upnp-org:service-1-0\">"
    "<specVersion>"
    "<major>1</major>"
    "<minor>0</minor>"
    "</specVersion>"
    "<actionList>"
/*    "<action>"
    "<name>GetSearchCapabilities</name>"
    "<argumentList>"
    "<argument>"
    "<name>SearchCaps</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>SearchCapabilities</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
*/    "<action>"
    "<name>GetSortCapabilities</name>"
    "<argumentList>"
    "<argument>"
    "<name>SortCaps</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>SortCapabilities</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
/*    "<action>"
    "<name>GetSystemUpdateID</name>"
    "<argumentList>"
    "<argument>"
    "<name>Id</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>SystemUpdateID</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
*/    "<action>"
    "<name>Browse</name>"
    "<argumentList>"
    "<argument>"
    "<name>ObjectID</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>BrowseFlag</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_BrowseFlag</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Filter</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>StartingIndex</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>RequestedCount</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>SortCriteria</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Result</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>NumberReturned</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>TotalMatches</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>UpdateID</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
/*    "<action>"
    "<name>Search</name>"
    "<argumentList>"
    "<argument>"
    "<name>ContainerID</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>SearchCriteria</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_SearchCriteria</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Filter</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>StartingIndex</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>RequestedCount</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>SortCriteria</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Result</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>NumberReturned</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>TotalMatches</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>UpdateID</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
*/    "</actionList>"
    "<serviceStateTable>"
    "<stateVariable sendEvents=\"no\">"	//    "<stateVariable sendEvents=\"yes\">"
    "<name>TransferIDs</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_ObjectID</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_Result</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_SearchCriteria</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_BrowseFlag</name>"
    "<dataType>string</dataType>"
    "<allowedValueList>"
    "<allowedValue>BrowseMetadata</allowedValue>"
    "<allowedValue>BrowseDirectChildren</allowedValue>"
    "</allowedValueList>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_Filter</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_SortCriteria</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_Index</name>"
    "<dataType>ui4</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_Count</name>"
    "<dataType>ui4</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_UpdateID</name>"
    "<dataType>ui4</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>SearchCapabilities</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>SortCapabilities</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"	///    "<stateVariable sendEvents=\"yes\">"
    "<name>SystemUpdateID</name>"
    "<dataType>ui4</dataType>"
    "</stateVariable>"
    "</serviceStateTable>"
    "</scpd>"
    ;

const char* template_conn =
    "<?xml version=\"1.0\"?>"
    "<scpd xmlns=\"urn:schemas-upnp-org:service-1-0\">"
    "<specVersion>"
    "<major>1</major>"
    "<minor>0</minor>"
    "</specVersion>"
    "<actionList>"
    "<action>"
    "<name>GetProtocolInfo</name>"
    "<argumentList>"
    "<argument>"
    "<name>Source</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>SourceProtocolInfo</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Sink</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>SinkProtocolInfo</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
/*    "<action>"
    "<name>GetCurrentConnectionIDs</name>"
    "<argumentList>"
    "<argument>"
    "<name>ConnectionIDs</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>CurrentConnectionIDs</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
    "<action>"
    "<name>GetCurrentConnectionInfo</name>"
    "<argumentList>"
    "<argument>"
    "<name>ConnectionID</name>"
    "<direction>in</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>RcsID</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_RcsID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>AVTransportID</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_AVTransportID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>ProtocolInfo</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ProtocolInfo</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>PeerConnectionManager</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ConnectionManager</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>PeerConnectionID</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Direction</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_Direction</relatedStateVariable>"
    "</argument>"
    "<argument>"
    "<name>Status</name>"
    "<direction>out</direction>"
    "<relatedStateVariable>A_ARG_TYPE_ConnectionStatus</relatedStateVariable>"
    "</argument>"
    "</argumentList>"
    "</action>"
*/    "</actionList>"
    "<serviceStateTable>"
    "<stateVariable sendEvents=\"no\">"	//    "<stateVariable sendEvents=\"yes\">"
    "<name>SourceProtocolInfo</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"	//    "<stateVariable sendEvents=\"yes\">"
    "<name>SinkProtocolInfo</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"	//    "<stateVariable sendEvents=\"yes\">"
    "<name>CurrentConnectionIDs</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_ConnectionStatus</name>"
    "<dataType>string</dataType>"
    "<allowedValueList>"
    "<allowedValue>OK</allowedValue>"
    "<allowedValue>ContentFormatMismatch</allowedValue>"
    "<allowedValue>InsufficientBandwidth</allowedValue>"
    "<allowedValue>UnreliableChannel</allowedValue>"
    "<allowedValue>Unknown</allowedValue>"
    "</allowedValueList>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_ConnectionManager</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_Direction</name>"
    "<dataType>string</dataType>"
    "<allowedValueList>"
    "<allowedValue>Input</allowedValue>"
    "<allowedValue>Output</allowedValue>"
    "</allowedValueList>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_ProtocolInfo</name>"
    "<dataType>string</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_ConnectionID</name>"
    "<dataType>i4</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_AVTransportID</name>"
    "<dataType>i4</dataType>"
    "</stateVariable>"
    "<stateVariable sendEvents=\"no\">"
    "<name>A_ARG_TYPE_RcsID</name>"
    "<dataType>i4</dataType>"
    "</stateVariable>"
    "</serviceStateTable>"
    "</scpd>"
    ;

const char* template_sortcap =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<s:Envelope"
" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\""
" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body>"
"<u:GetSortCapabilitiesResponse"
" xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
"<SortCaps>dc:title,dc:date</SortCaps>"
"</u:GetSortCapabilitiesResponse>"
"</s:Body>"
"</s:Envelope>"
    ;

const char* template_protoinfo =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<s:Envelope"
" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\""
" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
"<s:Body>"
"<u:GetProtocolInfoResponse"
" xmlns:u=\"urn:schemas-upnp-org:service:ConnectionManager:1\">"
"<Source>"
"http-get:*:" MIME_V ":DLNA.ORG_PN=" DLNA_PN
"</Source>"
"<Sink/>"
"</u:GetProtocolInfoResponse>"
"</s:Body>"
"</s:Envelope>"
    ;

const char* template_browse_1 =
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
    "<s:Body>"
    "<u:BrowseResponse xmlns:u=\"urn:schemas-upnp-org:service:ContentDirectory:1\">"
    "<Result>"
    "&lt;DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"&gt;"
    ;

const char* template_browse_2 =
    "&lt;container id=\"%s/%s\" parentID=\"%s\" restricted=\"1\"&gt;"
    "&lt;dc:title&gt;"
    "%s"
    "&lt;/dc:title&gt;"
    "&lt;upnp:class&gt;"
    "object.container.storageFolder"
    "&lt;/upnp:class&gt;"
    "&lt;/container&gt;"
    ;

const char* template_browse_3 =
    "&lt;item id=\"%s/%s\" parentID=\"%s\" restricted=\"1\"&gt;"
    "&lt;dc:title&gt;"
    "%s"
    "&lt;/dc:title&gt;"
    "&lt;upnp:class&gt;"
    "object.item.videoItem"
    "&lt;/upnp:class&gt;"
    "&lt;dc:date&gt;"
    "%s"
    "&lt;/dc:date&gt;"
    "&lt;res size=\"%s\" duration=\"%s\" bitrate=\"%s\" resolution=\"%s\""
    " protocolInfo=\"http-get:*:" MIME_V ":DLNA.ORG_PN=" DLNA_PN ";DLNA.ORG_OP=11;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=61700000000000000000000000000000\"&gt;"
    "%s/%s"
    "&lt;/res&gt;"
    "&lt;/item&gt;"
    ;

const char* template_browse_4 =
    "&lt;/DIDL-Lite&gt;"
    "</Result>"
    "<NumberReturned>%d</NumberReturned>"
    "<TotalMatches>%d</TotalMatches>"
    "<UpdateID>0</UpdateID>"
    "</u:BrowseResponse>"
    "</s:Body>"
    "</s:Envelope>"
    ;
